package com.learn.metrics.type.healthCheck.check;

import cn.hutool.core.util.RandomUtil;
import com.codahale.metrics.health.HealthCheck;

/**
 * @author XuYang
 * @since 2025/2/19 10:18
 */
public class RandomHealthCheck
    extends HealthCheck
{

    @Override
    protected Result check() throws Exception {
        if (RandomUtil.randomInt(1, 10) > 8) {
            return Result.unhealthy("Random health check failed");
        }
        return Result.healthy();
    }
}
